<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<head>
	<title><fmt:message key="user.userlisttitle" />
	</title>
</head>
<script type="text/javascript"
	src="<c:url value='/ext/scripts/display/displaypage.js'/>">
</script>
<script type="text/javascript"
	src="${ctx}/ext/scripts/user/selectarea.js">
</script>
<script>
jQuery(function(){
		jQuery("#displayallpage").val(${displayallpage});
		jQuery("#tz").val(${thispage});
	});
</script>
<div class="box_big">
	<form:form commandName="user" method="post"
		action="${ctx}/user/users.html?method=select" id="searchForm">
		<div class="tabbiao">
			<div class="r">
				<div class="con">
					<div style="float: left; width: 100%; margin: 0; padding: 0;" onclick="hiddenselectcon();">
						<h6>
							<fmt:message key="user.selectcon" />
						</h6>
					</div>
				</div>
			</div>
		</div>
		<div class="lable_box" id="selectcondiv" style="display: none;" >
			
			<table border="0" cellspacing="0" cellpadding="0" class="table_surch">
				
					<tr>
						<fmt:message key="user.username" />:
						:
						<form:input path="username" cssClass="text"
							cssStyle="width:80px;" />
					</tr>
					<tr>
						<fmt:message key="user.realname" />
						:
						<form:input path="realname" cssClass="text"
							cssStyle="width:80px;" />
					</tr>
					    <fmt:message key="user.companytable" />
						:
					    <form:input path="company" cssClass="text"
					       cssStyle="width:80px;" />
				    </tr>	
				    <tr>
						<fmt:message key="user.territory" />
						:
			         <form:select path="territory" cssClass="text"
			            cssStyle="width:85px;">
			              <option value=""><fmt:message key="common.pleaseselect"/></option>
			          			<c:forEach var="t" items="${territory}">
									<form:option value="${t.key}">${t.value}</form:option>
								</c:forEach>
					</form:select>
		    	<%-- <tr> 
						<form:select path="territory" cssClass="text">
				
						</form:select>
					</tr>--%>
				</tr>
				<tr>
				<fmt:message key="user.islocked" />
						:
						<form:select path="islocked" cssClass="text4"
							cssStyle="width:85px;">
							<option value="">
								<fmt:message key="common.pleaseselect" />
							</option>
							<form:option value="1">
								<fmt:message key="user.locked" />
							</form:option>
							<form:option value="2">
								<fmt:message key="user.nolocked" />
							</form:option>
						</form:select>
					</tr>
					
					<tr>
						<fmt:message key="user.area" />
						:
						<form:select path="country" cssClass="text4"
							cssStyle="width:80px;">
							<option value="">
								<fmt:message key="user.selectarea" />
							</option>
							<form:option value="中国">中国</form:option>
						</form:select>
						
						<form:select path="province" cssClass="text4"
							cssStyle="width:80px;" onchange="changepro('city','province');">
							<option value="">
								<fmt:message key="user.selectprovice" />
							</option>
							<form:option value='北京市'>
								北京市
							</form:option>
							<form:option value='天津市'>
								天津市
							</form:option>
							<form:option value='河北省'>
								河北省
							</form:option>
							<form:option value='山西省'>
								山西省
							</form:option>
							<form:option value='内蒙古自治区'>
								内蒙古自治区
							</form:option>
							<form:option value='辽宁省'>
								辽宁省
							</form:option>
							<form:option value='吉林省'>
								吉林省
							</form:option>
							<form:option value='黑龙江省'>
								黑龙江省
							</form:option>
							<form:option value='上海市'>
								上海市
							</form:option>
							<form:option value='江苏省'>
								江苏省
							</form:option>
							<form:option value='浙江省'>
								浙江省
							</form:option>
							<form:option value='安徽省'>
								安徽省
							</form:option>
							<form:option value='福建省'>
								福建省
							</form:option>
							<form:option value='江西省'>
								江西省
							</form:option>
							<form:option value='山东省'>
								山东省
							</form:option>
							<form:option value='河南省'>
								河南省
							</form:option>
							<form:option value='湖北省'>
								湖北省
							</form:option>
							<form:option value='湖南省'>
								湖南省
							</form:option>
							<form:option value='广东省'>
								广东省
							</form:option>
							<form:option value='广西壮族自治区'>
								广西壮族自治区
							</form:option>
							<form:option value='海南省'>
								海南省
							</form:option>
							<form:option value='重庆市'>
								重庆市
							</form:option>
							<form:option value='四川省'>
								四川省
							</form:option>
							<form:option value='贵州省'>
								贵州省
							</form:option>
							<form:option value='云南省'>
								云南省
							</form:option>
							<form:option value='西藏自治区'>
								西藏自治区
							</form:option>
							<form:option value='陕西省'>
								陕西省
							</form:option>
							<form:option value='甘肃省'>
								甘肃省
							</form:option>
							<form:option value='青海省'>
								青海省
							</form:option>
							<form:option value='宁夏回族自治区'>
								宁夏回族自治区
							</form:option>
							<form:option value='新疆维吾尔自治区'>
								新疆维吾尔自治区
							</form:option>
							<form:option value='台湾省'>
								台湾省
							</form:option>
							<form:option value='香港特别行政区'>
								香港特别行政区
							</form:option>
							<form:option value='澳门特区'>
								澳门特区
							</form:option>
						</form:select>
						<form:select path="city" cssClass="text4" cssStyle="width:80px;"
							onchange="changecity('county','city');">
							<option value="">
								<fmt:message key="user.selectcity" />
							</option>
						</form:select>
						
						<form:select path="county" cssClass="text4" cssStyle="width:80px;">
							<option value="">
								<fmt:message key="user.selectcounty" />
							</option>
						</form:select>
				</tr>
				
					<td>
						<fmt:message key="user.registertime" />
						:
						<form:input path="starttime"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',lang:'${lang}'});"
							cssClass="Wdate text" />
						<fmt:message key="order.to" />
						<form:input path="endtime"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"
							cssClass="Wdate text" />
					</td>
					
						
					</td>
					<td>
						<input type="submit" class="btn_search" value=""/>
					</td>
				
			</table>
		</div>
		<div class="adddi"><div class="r"><div class="con">
		<table width="100%">
			<tr>
				<td align="left">
					<input type="button" 
						onclick="location.href='<c:url value="/user/userform.html?method=add"/>'"
						 class="btn_add" />
				</td>
			</tr>
		</table>
		</div>
		</div>
		</div>
	</form:form>
	<form id="deleteform" method="post">
		<input type="hidden" name="ptmeth" value="${ptmeth}" />
		<input type="hidden" name="tz" value="${thispage}" />
	</form>
	
		<display:table name="userList" cellspacing="0" cellpadding="0"
			requestURI="" style="width:100%;" id="users" pagesize="${pagesize}"
			class="table_display" export="true" size="${resultSize}"
			partialList="true">
			<display:column property="username" escapeXml="true" sortable="true"
				titleKey="user.username" style="border-left:1px solid #feb808;" />
			<display:column property="realname" escapeXml="true" sortable="true"
				titleKey="user.realname" />
			<display:column property="company" escapeXml="true" sortable="true"
				titleKey="user.companytable" />
			<display:column property="registertime" sortable="true"
				titleKey="user.registertime" format="{0,date,yyyy-MM-dd HH:mm:ss}"
				maxLength="15" />
			<display:column escapeXml="true" sortable="true"
				titleKey="user.territory">
				<c:forEach var="t" items="${territory}">
					<c:if test="${t.key eq users.territory}">
			${t.value}
		</c:if>
				</c:forEach>
			</display:column>
			<display:column escapeXml="true" sortable="true"
				titleKey="user.roles" maxLength="100" style="width:15%;">
				<c:forEach var="r" items="${users.roles}" varStatus="state">
					<c:if test="${state.index == 0}">${r.rolename}</c:if>
					<c:if test="${state.index != 0}">,${r.rolename}</c:if>
				</c:forEach>
			</display:column>
			<display:column escapeXml="true" titleKey="user.islocked">
				<c:if test="${users.islocked != null}">
					<c:if test="${users.islocked eq '1'}">
						<fmt:message key="user.locked" />
					</c:if>
					<c:if test="${users.islocked eq '2'}">
						<fmt:message key="user.nolocked" />
					</c:if>
				</c:if>
			</display:column>
			<display:column titleKey="user.operate" autolink="true" media="html"
				style="border-right:1px solid #feb808;">
				<a
					href="${ctx}/user/userform.html?method=update&id=<c:out value="${users.id}"/>&tz=${thispage}&ptmeth=${ptmeth}">
					<fmt:message key="button.update" /> </a>
		&nbsp;&nbsp;&nbsp;
		<a onclick="onDelete(<c:out value="${users.id}"/>)"> <fmt:message
						key="button.delete" /> </a>
			</display:column>
			<display:setProperty name="export.pdf" value="false" />
			<display:setProperty name="export.csv" value="false" />
			<display:setProperty name="export.xml" value="false" />
		</display:table>
</div>
<script type="text/javascript">
highlightTableRows("users");
function onDelete(id) {
	var msg = "<fmt:message key="user.deletemsg"/>";
    	ans = confirm(msg);
    	if(ans)
   		{
	    	var form = document.getElementById("deleteform");
	    	form.action = "${ctx}/user/saveuser.html?delete=delete&id="+id;
	    	form.submit();
   		}
    }
    
</script>